// cancel 的原理
let cancel;
const token = new Promise(resolve => {
  cancel = resolve;
}).then(message => {
  // xhr.abort(message);
  console.log(message);
});

cancel('取消请求');
console.log(1);
